#include <stdio.h>
#include <vector>
#include <map>
#include <algorithm>

bool compare(std::pair<int,int> a, std::pair<int,int> b)
{
	if (a.second > b.second)
		return true;
	else if (a.second < b.second)
		return false;
	else if (a.first < b.first)
		return false;
	else
		return true;
}

int main()
{
	FILE* file = fopen("stepic_dataset.txt", "r");
	FILE* out = fopen("result.txt", "w");
	std::vector<int> spectr;
	while (!feof(file))
	{
		int num;
		fscanf(file, "%d ", &num);
		spectr.push_back(num);
	}

	std::map<int,int> diff;
	for (int i=0; i<spectr.size(); i++)
	{
		for (int j=0; j<spectr.size(); j++)
		{
			int dif = spectr[i] - spectr[j];
			if (dif > 0) {
				auto f = diff.find(dif);
				if (f == diff.end())
					diff.insert(std::pair<int,int>(dif, 1));
				else
					f->second = f->second + 1;
			}
		}
	}

	std::vector<std::pair<int,int>> vec(diff.begin(), diff.end());

	std::sort(vec.begin(), vec.end(), compare);
	for (auto it=vec.begin(); it!=vec.end(); it++)
		fprintf(out, "%d ", it->first);


	return 0;
}